<?php

/**
 * @author     Thibaut Cromphaut and Dimitry Dierickx
 * @copyright  Copyright (c) 2011 Safti-Kado
 */
class Application_Form_Registration extends Zend_Form
{

    public function init()
    {

        // Veld 'Voornaam'
        $this->addElement('text', 'givenname', array(
            'label'      => 'Voornaam:',
            'required'   => true,
            'filters'    => array('StringTrim'),
            'validators' => array(
                'Alpha',
                array('StringLength', false, array(1, 45)),
            ),
        ));

        // Veld 'Familienaam'
        $this->addElement('text', 'familyname', array(
            'label'      => 'Familienaam:',
            'required'   => true,
            'filters'    => array('StringTrim'),
            'validators' => array(
                'Alpha',
                array('StringLength', false, array(1, 45)),
            ),
        ));

        // Veld 'E-mailadres'
        $this->addElement('text', 'email', array(
            'label'      => 'E-mailadres:',
            'required'   => true,
            'filters'    => array('StringTrim'),
            'validators' => array('EmailAddress'),
        ));

        // Veld 'Wachtwoord'
        $this->addElement('password', 'password', array(
            'label'      => 'Wachtwoord:',
            'required'   => true,
            'filters'    => array('StringTrim'),
            'validators' => array(
                'Alnum',
                array('StringLength', false, array(8, 45)),
            ),
        ));

        // Veld 'Wachtwoord (herhaal)'
        $this->addElement('password', 'passwordRepeat', array(
            'label'      => 'Wachtwoord (herhaal):',
            'required'   => true,
            'filters'    => array('StringTrim'),
            'validators' => array(
                'Alnum',
                array('StringLength', false, array(8, 45)),
                array('Identical', true, array('password')),
            ),
        ));

        // Knop 'Versturen'
        $this->addElement('submit', 'send', array(
            'label'      => 'Versturen',
        ));

        // CSRF-preventie (Cross-Site Request Forgery)
        $this->addElement('hash', 'no_csrf_registration', array(
            'salt' => 'unique',
        ));

    }

}

